<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>重置密码</title>
    <script src="http://47.106.66.89:8080/js/vue.min.js"></script>
    <script src="http://47.106.66.89:8080/js/axios.min.js"></script>
    <link  href="http://47.106.66.89:8080/js/ele-2.15.7/theme-chalk/index.css" rel="stylesheet">
    <script src="http://47.106.66.89:8080/js/ele-2.15.7/index.js"></script>
</head>
<body>
<div style="width: 200px;border: 1px #333 solid;margin: 100px auto" >
  新密码:<input/><br/>
  确认密码:<input/><br/>
  <button @click="updatePwd">修改密码</button>
</div>

<script>
    let vue = new Vue({
        data:{
            pwd:"",
            newPwd:"",
        },
        methods:{
            updatePwd(){
                if(!this.pwd){
                    this.$alert("请输入密码！");
                    return
                }

                if (!this.newPwd){
                    this.$alert("请确认密码！");
                    return
                }

                if (this.pwd != this.newPwd){
                    this.$alert("两次输入的密码不匹配！请重新输入");
                    this.newPwd = '';
                    return
                }

                axios.post("/updatePwd",pwd=this.pwd).then( res => {
                    if (res.data.code == 1){
                        this.$message('密码修改成功！');
                    }else{
                        this.$message('密码修改失败！');
                    }
                })
            }
        }
    })
</script>
</body>
</html>